<template>
  <div class="app">
    <h2>我是App组件{{ wanju }}</h2>
    <button @click="welcome">点我欢迎你</button>
    <Child @send-toy="getToy"/>
  </div>
</template>

<script>
  import Child from './components/Child.vue'

  export default {
    name:'App',
    components:{Child},
    data() {
      return {
        wanju:''
      }
    },
    methods: {
      welcome(){
        alert('欢迎欢迎热烈欢迎！')
      },
      getToy(value){
        console.log('App收到了',value)
        this.wanju = value
      }
    },
  }
</script>

<style>
  .app {
    background-color: #ddd;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 0 10px;
  }
</style>